import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class CommFrame extends JFrame implements ActionListener{
    File file = null;
    JMenuBar bar;
    JMenu fileMenu;
    JMenuItem inputMenuItem,showMenuItem;
    JTextArea show;
    InputArea inputMessage;
    CardLayout card = null;
    JPanel pCenter;
    CommFrame(){
        file = new File("通讯录.txt");
        inputMenuItem = new JMenuItem("录入");
        showMenuItem = new JMenuItem("显示");
        bar  =new JMenuBar();
        fileMenu = new JMenu("菜单选项");
        fileMenu.add(inputMenuItem);
        fileMenu.add(showMenuItem);
        bar.add(fileMenu);
        setJMenuBar(bar);
        inputMenuItem.addActionListener(this);
        showMenuItem.addActionListener(this);
        inputMessage=new InputArea(file);
        show = new JTextArea(12,20);
        card=new CardLayout();
        pCenter=new JPanel();
        pCenter.setLayout(card);

    }
}
